package cn.iocoder.yudao.module.api.pay.transfer.enums;

import cn.iocoder.yudao.framework.business.basic.enums.EnumCodable;
import com.baomidou.mybatisplus.annotation.EnumValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;
import java.util.stream.Stream;

/**
 * <pre>
 * OOoO0OOoO0OOOooo0oOOOO0OOOOO0oooOO0ooOOO0Ooooo0OOOOo0ooooO0OOooo0Ooooo0OOOOO
 *  转账到账时效枚举
 * OOoO0OOoO0OOOooo0oOOOO0OOOOO0oooOO0ooOOO0Ooooo0OOOOo0ooooO0OOooo0Ooooo0OOOOO
 * </pre>
 *
 * @author 山野羡民（1032694760@qq.com）
 * @since 2025/01/09
 */
@Getter
@AllArgsConstructor
public enum UnifiedTransferPeriodType implements EnumCodable {

    UNKNOWN("", "未知"),
    T1("T1", "下一个工作日到账"),
    D0("D0", "实时到账有额外费用"),
    D1("D1", "下一个自然日到账"),
    DM("DM", "实时到账没有费但有额度限制"),
    ;

    @EnumValue
    private final String code;
    private final String name;

    public static UnifiedTransferPeriodType codeOf(String code) {
        return Stream.of(values())
                .filter(p -> Objects.equals(p.code, code))
                .findAny()
                .orElse(UNKNOWN);
    }

}
